#pragma once

struct Float2
{
	float x, y;
};

struct Float3
{
	float x, y, z;
};


struct Image
{
	unsigned int * Pixels;
	int Width, Height;
};

struct Matrix3
{
	float m[9];
	Float2 Transform(float x, float y)
	{
		Float2 rs;
		rs.x = m[0]*x + m[1]*y + m[2];
		rs.y = m[3]*x + m[4]*y + m[5];
		float z = m[6]*x + m[7]*y + m[8];
		float invZ = 1.0f/z;
		rs.x *= invZ;
		rs.y *= invZ;
		return rs;
	}

	Float2 Transform(Float2 v)
	{
		return Transform(v.x, v.y);
	}
	
};
Matrix3 ComputeHomography(float* x1, float *y1, float *x2, float *y2);
void Rectify(::Image im, ::Image rs, float * x1, float * y1);